<?php

namespace app\common\model;

use think\Model;
use think\model\concern\SoftDelete;

class User extends Model
{
    /**
     * Use Thinkphp ORM Model
     */
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;
    protected $autoWriteTimestamp = 'int';

    /**
     * 获取用户信息
     * @params string
     * @return
     */
    public static function getUserInfo($where = [], $field = '*')
    {
        return self::where($where)->field($field)->findOrEmpty()->toArray();
    }

    /**
     * 更改用户信息
     * @param  [type] $id   [description]
     * @param  [type] $data [description]
     * @return [type]       [description]
     */
    public static function editUserInfo($id, $data = [])
    {
        $data = array_merge($data, ['update_time'=>time()]);
        
        return self::update($data, ['id' => $id]);
    }
}